<#include "../inc/view.html"/>
<@view>
            <form id="sysUserAddForm${nowtime}" name="sysUserAddForm" class="form-horizontal" action="/admin/sysUser/save" method="post" data-validator-option="{theme:'yellow_top'}">
                <input type="hidden" name="sysUser.id" value="${(po.id)!}">
            <div class="row">
                <div class="col-sm-6">
                    <ol class="breadcrumb">
                        <li>
                            <b>系统</b>
                        </li>
                        <li>
                            <a href="javascript:void(0);" onclick="contentLoadPage('/sysUser')">用户</a>
                        </li>
                        <li class="active">
                            <#if po??>修改
                                <#else>新增
                            </#if>
                        </li>
                    </ol>
                </div>
                <div class="col-sm-6">
                    <a onclick="contentLoadPage('/sysUser')" class="btn-sm btn-white pull-right" style="margin-left:10px;"><i class="ti-arrow-left"></i>返回</a>
                    <button type="submit" class="btn-sm btn-success pull-right"><i class="ti-save"></i>保存</button>
                </div>
            </div>
            <hr>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">账号</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysUser.account" data-rule="账号:required" value="${(po.account)!}"<#if (po.id)??>readonly</#if>>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">密码</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysUser.password" value="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">真实姓名</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysUser.realname" value="${(po.realname)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">性别</label>
                            <div class="col-md-10">
                                <label><input type="radio" name="sysUser.sex"<#if 0==(po.sex)!0>checked="checked" </#if> value="0">未知</label>
                                <label><input type="radio" name="sysUser.sex"<#if 1==(po.sex)!0>checked="checked" </#if> value="1">男</label>
                                <label><input type="radio" name="sysUser.sex"<#if 2==(po.sex)!0>checked="checked" </#if> value="2">女</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">Email</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysUser.email" data-rule="Email:email" value="${(po.email)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">角色</label>
                            <div class="col-md-10">
                                <select multiple="multiple" class="multi-select select2" id="my_multi_select1" name="roleList" id="roleList" data-plugin="multiselect">
                                    <#if userRoleList??>
                                        <#list userRoleList as r>
                                            <option value="${r.id}" selected>${r.name}</option>
                                        </#list>
                                    </#if>
                                    <#list roleList as r>
                                        <option value="${r.id}">${r.name}</option>
                                    </#list>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">状态</label>
                            <div class="col-md-10">
                                <label><input type="radio" name="sysUser.status" value="1" <#if 1==(po.status)!0 >checked</#if> /> 启用</label>
                                <label><input type="radio" name="sysUser.status" value="0" <#if 2==(po.status)!0 >checked</#if> />禁用</label>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
</@view>
<script>
    $(function(){
        $(".select2").select2();
        ajaxForm($("#sysUserAddForm${nowtime}"),function(json){
            if(json.code==RESULT_SUCCESS){
                contentLoadPage('/sysUser');
            }else{
                if(json.msg)
                    layer.alert(json.msg,{icon:5,title:'系统提示',shadeClose:true});
            }
        });
    });
</script>